Method and device for providing compensation offsets for a set of reconstructed samples of an image

ABSTRACT

Compensation offsets are provided for a set of reconstructed samples of an image. Each sample has a sample value. A method of providing the compensation offsets comprises selecting, based on a rate distortion criterion, a classification from among a plurality of predetermined classifications. Each predetermined classification has a classification range smaller than a full range of the sample values and is made up of a plurality of classes, each defining a range of sample values within the classification range, into which class a sample is put if its sample value is within the range of the class concerned. A compensation offset is associated with each class of the selected classification for application to the sample value of each sample of the class.

The present invention relates to a method and device for providingcompensation offsets for a set of reconstructed samples of an image. Theinvention further concerns a method and device for encoding or decodinga sequence of digital images.

The invention may be applied in the field of digital signal processing,and in particular in the field of video compression using motioncompensation to reduce spatial and temporal redundancies in videostreams.

Many video compression formats, such as for example H.263, H.264,MPEG-1, MPEG-2, MPEG-4, SVC, use block-based discrete cosine transform(DCT) and motion compensation to remove spatial and temporalredundancies. They are often referred to as predictive video formats.Each frame or image of the video signal is divided into slices which areencoded and can be decoded independently. A slice is typically arectangular portion of the frame, or more generally, a portion of aframe or an entire frame. Further, each slice may be divided intomacroblocks (MBs), and each macroblock is further divided into blocks,typically blocks of 64×64, 32×32, 16×16 or 8×8 pixels.

In High Efficiency Video Coding (HEVC) blocks of from 64×64, to 4×4 maybe used. The partitioning is organized according to a quad-treestructure based on the largest coding unit (LCU). An LCU corresponds toa square block of 64×64. If an LCU needs to be divided, a split flagindicates that the LCU is split into 4 32×32 blocks. In the same way, ifany of these 4 blocks need to be split, the split flag is set to trueand the 32×32 block is divided into 4 16×16 blocks etc. When a splitflag is set to false, the current block is a coding unit CU. A CU has asize equal to 64×64, 32×32, 16×16 or 8×8 pixels.

There are two families of coding modes for coding blocks of an image:coding modes based on spatial prediction, referred to as INTRAprediction and coding modes based on temporal prediction (INTER, Merge,Skip). In both spatial and temporal prediction modes, a residual iscomputed by subtracting the prediction from the original block.

An INTRA block is generally predicted by an INTRA prediction processfrom the encoded pixels at its causal boundary. In INTRA prediction, aprediction direction is encoded.

Temporal prediction consists in finding in a reference frame, either aprevious or a future frame of the video sequence, an image portion orreference area which is the closest to the block to be encoded. Thisstep is typically known as motion estimation. Next, the block to beencoded is predicted using the reference area in a step typicallyreferred to as motion compensation—the difference between the block tobe encoded and the reference portion is encoded, along with an item ofmotion information relative to the motion vector which indicates thereference area to use for motion compensation. In temporal prediction,at least one motion vector is encoded.

In order to further reduce the cost of encoding motion information,rather than directly encoding a motion vector, assuming that motion ishomogeneous the motion vector may be encoded in terms of a differencebetween the motion vector and a motion vector predictor, typicallycomputed from one or more motion vectors of the blocks surrounding theblock to be encoded.

In H.264, for instance motion vectors are encoded with respect to amedian predictor computed from the motion vectors situated in a causalneighbourhood of the block to be encoded, for example from the threeblocks situated above and to the left of the block to be encoded. Onlythe difference, referred to as a residual motion vector, between themedian predictor and the current block motion vector is encoded in thebitstream to reduce the encoding cost.

Encoding using residual motion vectors saves some bitrate, butnecessitates that the decoder performs the same computation of themotion vector predictor in order to decode the value of the motionvector of a block to be decoded.

Both encoding and decoding processes may involve a decoding process ofan encoded image. This process is typically performed at the encoderside for the purpose of future motion estimation which enables anencoder and a corresponding decoder to have the same reference frames.

To reconstruct the coded frame, the residual is inverse quantized andinverse transformed in order to provide the “decoded” residual in thepixel domain. The first reconstruction is then filtered by one orseveral kinds of post filtering processes. These post filters areapplied on the reconstructed frame at encoder and decoder side in orderthat the same reference frame is used at both sides. The aim of thispost filtering is to remove compression artifact. For example, H.264/AVCuses a deblocking filter. This filter can remove blocking artifacts dueto the DCT quantization of residual and to block motion compensation. Inthe current HEVC standard, 3 types of loop filters are used: deblockingfilter, sample adaptive offset (SAO) and adaptive loop filter (ALF).

FIG. 1 is a flow chart illustrating steps of loop filtering process of aknown HEVC implementation. In an initial step 101, the encoder ordecoder generates the reconstruction of the full frame. Next, in step102 a deblocking filter is applied on this first reconstruction in orderto generate a deblocked reconstruction 103. The aim of the deblockingfilter is to remove block artifacts generated by residual quantizationand block motion compensation or block Intra prediction. These artifactsare visually important at low bitrates. The deblocking filter operatesto smooth the block boundaries according to the characteristics of twoneighboring blocks. The encoding mode of each block, the quantizationparameters used for the residual coding, and the neighboring pixeldifferences in the boundary are taken into account. The samecriterion/classification is applied for all frames and no additionaldata is transmitted. The deblocking filter improves the visual qualityof the current frame by removing blocking artifacts and it also improvesthe motion estimation and motion compensation for subsequent frames.Indeed, high frequencies of the block artifact are removed, and so thesehigh frequencies do not need to be compensated for with the textureresidual of the following frames.

After the deblocking filter, the deblocked reconstruction is filtered bya sample adaptive offset (SAO) loop filter in step 104. The resultingframe 105 is then filtered with an adaptive loop filter (ALF) in step106 to generate the reconstructed frame 107 which will be displayed andused as a reference frame for the following Inter frames.

The aim of SAO loop filter and the ALF is to improve framereconstruction by sending additional data as opposed to a deblockingfilter where no information is transmitted.

The principle of SAO loop filter is to classify each pixel into a classand to add the same offset value to the respective pixel value of eachpixel of the class. Thus one offset is transmitted for each class. SAOloop filtering provides two kinds of classification for a frame area:edge offset and band offset.

Edge offset classification involves determining a class for each pixelby comparing its corresponding pixel value to the pixel values of twoneighboring pixels. Moreover, the two neighboring pixels depend on aparameter which indicates the direction of the 2 neighboring pixels.These directions are a 0-degree (horizontal direction), a 45-degree(diagonal direction), a 90-degree (vertical direction) and a 135-degree(second diagonal direction). In the following these directions arecalled “type” of edge offset classification.

The second type of classification is a band offset classification whichdepends on the pixel value. A class in SAO band offset corresponds to arange of pixel values. Thus, the same offset is added to all pixelshaving a pixel value within a given range of pixel values.

In order to be more adaptive to the frame content, it has been proposedto apply SAO filtering based on a quad-tree structure to encode the SAO.Consequently, the frame area which corresponds to a leaf node of thequad tree may or may not be filtered by SAO such that only some areasare filtered. Moreover, when SAO is enabled, only one SAO classificationis used: edge offset or band offset according to the related parameterstransmitted for each classification. Finally, for each SAO leaf node,the SAO classification as well as its parameters and the offsets of allclasses are transmitted.

The main advantage of the quad-tree is to follow efficiently the localproperties of the signal. However, it requires a dedicated encoding inthe bitstream. Another solution replacing the quad-tree based encodingof the SAO parameters by an encoding at the LCU level can be alsoenvisaged.

An image of video data to be encoded may be provided as a set oftwo-dimensional arrays (also known as colour channels) of sample values,each entry of which represents the intensity of a colour component suchas a measure of luma brightness and chroma colour deviations fromneutral grayscale colour toward blue or red (YUV) or as a measure ofred, green, or blue light component intensity (RGB). A YUV model definesa colour space in terms of one luma (Y) and two chrominance (UV)components. Generally Y stands for the luma component (brightness) and Uand V are the chrominance (colour) or chroma components.

SAO filtering is typically applied independently on Luma and on both Uand V Chroma components.

A known implementation of SAO band offset splits the range of pixelvalues into predefined 32 ranges of the same size as depicted in FIG. 2.The minimum value of the range of pixel values is systematically 0 andthe maximum value depends on the bit-depth of the pixel values accordingto the following relationship Max=2^(Bitdepth)−1. For example, when thebit-depth is 8 bits, the maximum value of a pixel can be 255. Thus, therange of pixel values is between 0 and 255. For this bit-depth of 8bits, each class includes a range of 16 pixel values. Moreover for SAOband offset, 2 groups of classes are considered. The first one contains16 successive classes in the center of the range of pixel values asdepicted in grey color in FIG. 2. The second group also contains 16classes but on both ends of the range of pixel values as depicted inhatched in FIG. 2. For SAO band offset of a frame area, the group usedfor the classification and the 16 offsets are inserted in the bitstream.

FIG. 3 is a flow chart illustrating steps of a method for selectingoffsets in an encoder for a current frame region 303. The frame areacontains N pixels. In an initial step 301 the variables Sum_(j) andSumNbPix_(j) are set to a value of zero for each of the 16 ranges. jdenotes the current range or class number. Sum_(j) denotes the sum ofthe difference between the value of the pixels in the range j and thevalue of their corresponding original pixels. SumNbPix_(j) denotes thenumber of pixels in the range j.

In step 302, the counter variable i is set to the value zero. Next, thefirst pixel of the frame area 303 is extracted in step 304. It isassumed that the current SAO group being processed is known (First orsecond as depicted in FIG. 2). If it is determined in step 305 that thepixel value P_(i) is not in the current SAO group then the countervariable i value is incremented in step 308 in order to classifysubsequent pixels of the frame area 303. Otherwise if it is determinedin step 305 that the pixel value P_(i) is in the current SAO group therange number (or class number) j corresponding to the value of P_(i) isfound in step 306. In subsequent step 307 the corresponding SumNbPix_(j)variable is incremented and the difference between P_(i) and itsoriginal value P_(i) ^(org) is added to Sum_(j). In the following step,the counter variable i is incremented in order to apply theclassification to the other pixels of the frame area 303. In step 309 itis determined whether or not all the N pixels of the frame area 303 havebeen classified (i.e. is i≧=N), if yes, an Offset_(j) for each class iscomputed in step 310 in order to produce an offset table 311 presentingan offset for each class j as the final result of the offset selectionalgorithm. This offset is computed as the average of the differencebetween the pixel values of the pixels of class j and their respectiveoriginal pixel values. The, Offset_(j) for class j is given by thefollowing equation:

$\begin{matrix}{{Offset}_{j} = \frac{{Sum}_{j}}{{SumNbPix}_{j}}} & (1)\end{matrix}$

FIG. 4 is a flow chart illustrating steps of a decoding process applyingthe SAO band offsets to corresponding groups of classes. This processmay also be applied at encoder side in order to produce the referenceframe used for the motion estimation and compensation of subsequentframes.

An initial step 401 of the process involves decoding the offset valuesfor each class of pixel values in order to produce an offsets table 402.At the encoder side, the offsets table 402 is the result of theselection algorithm shown in FIG. 3. Thus, at encoder side, step 401 isreplaced by the offset selection algorithm of FIG. 3.

In step 403 a counter variable i is set to 0. Pixel P_(i) is extractedin step 405 from a frame area 404 which contains N pixels. In step 406it is determined whether or not pixel P_(i) belongs to the current groupof classes. If it is determined that pixel P_(i) is in the current groupof classes, the related class number j is identified and the relatedoffset value Offset_(j) is extracted in step 409 from the offsets table402. The extracted offset value Offset_(j) is then added to the pixelvalue of P_(i) in step 410 in order to produce the filtered pixel valueP_(i)′ in step 411. The filtered pixel value is then inserted into thefiltered frame area 415 in step 412 at the corresponding pixel.

If in step 406 it is determined that pixel P_(i) is not in the SAO bandoffset group then the pixel value of P_(i) is put into the filteredframe area 415 in step 412 without filtering. After step 412, thecounter variable i is incremented in order to filter, if necessary, thesubsequent pixels of the current frame area 404. After it has beendetermined in step 414 that all the N pixels of the frame area have beenprocessed (i.e. i≧=N) the filtered frame area 415 is reconstructed andcan be added to the SAO reconstructed frame (cf. frame 105 of FIG. 1).

A drawback of the known process for selection of compensations is thatit is not adapted to different variations in image pixel content and tothe different types of components of image pixels.

The present invention has been devised to address one or more of theforegoing concerns.

According to a first aspect of the present invention there is provided amethod of providing compensation offsets for a set of reconstructedsamples of an image, each sample having a sample value, the methodcomprising

selecting, based on a rate distortion criterion, a classification fromamong a plurality of predetermined classifications, each saidpredetermined classification having a classification range smaller thana full range of the sample values and being made up of a plurality ofclasses, each defining a range of sample values within saidclassification range, into which class a sample is put if its samplevalue is within the range of the class concerned; and

associating with each class of the selected classification acompensation offset for application to the sample value of each sampleof the class concerned.

According to a second aspect of the present invention there is provideda method of encoding an image composed of a plurality of samples, themethod comprising

encoding the samples;

decoding the encoded samples to provide reconstructed samples;

performing loop filtering on the reconstructed samples, the loopfiltering comprising applying compensation offsets to the sample valuesof the respective reconstructed samples, each compensation offset beingassociated with a range of sample values, wherein the compensationoffsets are provided according to a method embodying the aforesaid firstaspect of the present invention; and

generating a bitstream of encoded samples.

According to a third aspect of the present invention there is provided amethod of decoding an image composed of a plurality of samples, eachsample having a sample value, the method comprising

receiving encoded sample values;

receiving encoded classification data;

receiving encoded compensation offsets;

decoding the classification data and selecting, based on the decodedclassification data, a classification from among a plurality ofpredetermined classifications, each said predetermined classificationhaving a classification range smaller than a full range of the samplevalues and being made up of a plurality of classes, each defining arange of sample values within said classification range, into whichclass a sample is put if its sample value is within the range of theclass concerned;

decoding the encoded samples to provide reconstructed sample values anddecoding the encoded compensation offsets;

associating the decoded compensation offsets respectively with theclasses of the selected classification; and

performing loop filtering on the reconstructed sample values, the loopfiltering comprising applying the decoded compensation offset associatedwith each class of the selected classification to reconstructed samplevalues within the range of the class concerned.

According to a fourth aspect of the present invention there is provideda signal carrying an information dataset for an image represented by avideo bitstream, the image comprising a set of reconstructable samples,each reconstructable sample having a sample value, the informationdataset comprising: classification data relating to a classificationselected by an encoder from among a plurality of predeterminedclassifications, each said predetermined classification having aclassification range smaller than a full range of the sample values andbeing made up of a plurality of classes, each defining a range of samplevalues within said classification range, into which class a sample isput if its sample value is within the range of the class concerned, andeach class of the plurality of classes of the selected classificationbeing associated with a compensation offset for application to samplevalues of the reconstructable samples within the range of the classconcerned.

According to a fifth aspect of the present invention there is provided adevice for providing compensation offsets for a set of reconstructedsamples of an image, each sample having a sample value, the devicecomprising:

means for selecting, based on a rate distortion criterion, aclassification from among a plurality of predetermined classifications,each said predetermined classification having a classification rangesmaller than a full range of the sample values and being made up of aplurality of classes, each defining a range of sample values within saidclassification range, into which class a sample is put if its samplevalue is within the range of the class concerned; and

means for associating with each class of the selected classification acompensation offset for application to the sample value of each sampleof the class concerned.

According to a sixth aspect of the present invention there is providedan encoding device for encoding an image composed of a plurality ofsamples, the device comprising

an encoder for encoding the samples;

a decoder for decoding the encoded samples to provide reconstructedsamples;

a loop filter for filtering the reconstructed samples, the loopfiltering means comprising offset application means for applyingcompensation offsets to the sample values of the respectivereconstructed samples, each compensation offset being associated with arange of sample values, wherein the compensation offsets are provided bya device embodying the aforesaid fifth aspect of the present invention;and

a bitstream generator for generating a bitstream of encoded samples.

According to a seventh aspect of the present invention there is provideda device for decoding an image composed of a plurality of samples, eachsample having a sample value, the device comprising

means for receiving encoded sample values;

means for receiving encoded classification data;

means for receiving encoded compensation offsets;

means for decoding the classification data and for selecting, based onthe decoded classification data, a classification from among a pluralityof predetermined classifications, each said predetermined classificationhaving a classification range smaller than a full range of the samplevalues and being made up of a plurality of classes, each defining arange of sample values within said classification range, into whichclass a sample is put if its sample value is within the range of theclass concerned;

means for decoding the encoded samples to provide reconstructed samplevalues and for decoding the encoded compensation offsets;

means for associating the decoded compensation offsets respectively withthe classes of the selected classification; and

means for performing loop filtering on the reconstructed sample values,the loop filtering comprising applying the decoded compensation offsetassociated with each class of the selected classification toreconstructed sample values within the range of the class concerned.

An eighth aspect of the present invention provides a method of decodingan image composed of a plurality of samples, each sample having a samplevalue, the method comprising:

receiving encoded sample values;

receiving encoded classification data relating to a classificationselected by an encoder from among a plurality of predeterminedclassifications, each said predetermined classification having aclassification range smaller than a full range of the sample values andbeing made up of a plurality of classes, each defining a range of samplevalues within said classification range, into which class a sample isplaced if its sample value is within the range of the class concerned;

receiving encoded compensation offsets associated respectively with theclasses of the selected classification;

decoding the encoded sample values to provide reconstructed samplevalues and decoding the encoded classification data and compensationoffsets; and

performing loop filtering on the reconstructed sample values, the loopfiltering comprising applying the decoded compensation offset associatedwith each class of the selected classification to reconstructed samplevalues within the range of the class concerned.

The encoder may select the classification in any suitable way includingbased on a rate-distortion criterion or in dependence on properties ofthe statistical distribution of sample values.

In the context of the present invention a sample may correspond to asingle pixel, with a sample value corresponding to the respective pixelvalue. Alternatively a sample may comprise a plurality of pixels, andthe sample value may correspond to a pixel value determined from thepixel values of the plurality of pixels.

At least parts of the methods according to the invention may be computerimplemented. Accordingly, the present invention may take the form of anentirely hardware embodiment, an entirely software embodiment (includingfirmware, resident software, micro-code, etc.) or an embodimentcombining software and hardware aspects that may all generally bereferred to herein as a “circuit”, “module” or “system”. Furthermore,the present invention may take the form of a computer program productembodied in any tangible medium of expression having computer usableprogram code embodied in the medium.

Since the present invention can be implemented in software, the presentinvention can be embodied as computer readable code for provision to aprogrammable apparatus on any suitable carrier medium. A tangiblecarrier medium may comprise a storage medium such as a floppy disk, aCD-ROM, a hard disk drive, a magnetic tape device or a solid statememory device and the like. A transient carrier medium may include asignal such as an electrical signal, an electronic signal, an opticalsignal, an acoustic signal, a magnetic signal or an electromagneticsignal, e.g. a microwave or RF signal.

Thus, according to a ninth aspect of the present invention there isprovided a computer program product for a programmable apparatus, thecomputer program product comprising a sequence of instructions forimplementing a method embodying any one of the aforesaid first, second,third and eighth aspects when loaded into and executed by theprogrammable apparatus.

According to a tenth aspect of the present invention there is provided acomputer-readable storage medium storing instructions of a computerprogram for implementing a method embodying any one of the aforesaidfirst, second, third and eighth aspects.

Embodiments of the invention will now be described, by way of exampleonly, and with reference to the following drawings in which: —

FIG. 1 is a flow chart illustrating steps of a loop filtering process ofthe prior art;

FIG. 2 graphically illustrates a sample adaptive band offsetclassification of a HEVC process of the prior art;

FIG. 3 is a flow chart illustrating steps of a process for determiningcompensation offsets for SAO band offset of HEVC;

FIG. 4 is a flow chart illustrating steps of a SAO band offset filteringprocess of HEVC;

FIG. 5 is a block diagram schematically illustrating a datacommunication system in which one or more embodiments of the inventionmay be implemented;

FIG. 6 is a block diagram illustrating components of a processing devicein which one or more embodiments of the invention may be implemented;

FIG. 7 is a flow chart illustrating steps of an encoding methodaccording to embodiments of the invention;

FIG. 8 is a flow chart illustrating steps of a loop filtering process ofin accordance with one or more embodiments of the invention;

FIG. 9 is a flow chart illustrating steps of a decoding method accordingto embodiments of the invention;

FIG. 10 is a flow chart illustrating steps of a method for determiningSAO bandoffset classification according to a first embodiment of theinvention;

FIG. 11 is a flow chart illustrating steps of a method for determiningadapted classification according to an embodiment of the invention;

FIG. 12 is a flow chart illustrating steps of a method for determiningadapted classification according to an alternative embodiment of theinvention;

FIG. 13 illustrates several sizes of the useful range for classificationin accordance with an embodiment of the invention;

FIG. 14 illustrates several sizes of classes for the classification inaccordance with an embodiment of the invention;

FIG. 15 illustrates several sizes of classes in a useful range for theclassification in accordance with an embodiment of the invention;

FIG. 16 illustrates several center positions of a useful range of afirst group for the classification in accordance with an embodiment ofthe invention;

FIG. 17 illustrates several center positions of a useful range of thesecond group for the classification in accordance with an embodiment ofthe invention; and

FIG. 18 illustrates the rate distortion selection of the parametersclassification in accordance with an embodiment of the invention.

FIGS. 19 a and 19 b illustrate possible positions of the useful rangewithin the full range in accordance with another embodiment of theinvention.

FIG. 20A illustrates a pseudo code applied in the prior art to encodethe SAO parameters at the LCU level.

FIG. 20B illustrates an improved pseudo code according to an embodimentof the invention to encode the SAO parameters at the LCU level.

FIG. 21 is a flow chart corresponding to the pseudo code of FIG. 20A.

FIG. 22 is a flow chart corresponding to the pseudo code of FIG. 20B.

FIG. 23 is a flow chart for use in explaining encoding of the SAOparameters according to a further embodiment of the present invention.

FIG. 24 illustrates a pseudo code used to encode the SAO parameters inaccordance with yet another embodiment of the present invention.

FIG. 25 is a flow chart corresponding to the pseudo code of FIG. 24.

FIG. 26 is a flow chart for use in explaining encoding of the SAOparameters according to a still further embodiment of the presentinvention.

FIG. 5 illustrates a data communication system in which one or moreembodiments of the invention may be implemented. The data communicationsystem comprises a transmission device, in this case a server 501, whichis operable to transmit data packets of a data stream to a receivingdevice, in this case a client terminal 502, via a data communicationnetwork 500. The data communication network 500 may be a Wide AreaNetwork (WAN) or a Local Area Network (LAN). Such a network may be forexample a wireless network (Wifi/802.11a or b or g), an Ethernetnetwork, an Internet network or a mixed network composed of severaldifferent networks. In a particular embodiment of the invention the datacommunication system may be a digital television broadcast system inwhich the server 501 sends the same data content to multiple clients.

The data stream 504 provided by the server 501 may be composed ofmultimedia data representing video and audio data. Audio and video datastreams may, in some embodiments of the invention, be captured by theserver 501 using a microphone and a camera respectively. In someembodiments data streams may be stored on the server 501 or received bythe server 501 from another data provider, or generated at the server501. The server 501 is provided with an encoder for encoding video andaudio streams in particular to provide a compressed bitstream fortransmission that is a more compact representation of the data presentedas input to the encoder.

In order to obtain a better ratio of the quality of transmitted data toquantity of transmitted data, the compression of the video data may befor example in accordance with the HEVC format or H.264/AVC format.

The client 502 receives the transmitted bitstream and decodes thereconstructed bitstream to reproduce video images on a display deviceand the audio data by a loud speaker.

Although a streaming scenario is considered in the example of FIG. 5, itwill be appreciated that in some embodiments of the invention the datacommunication between an encoder and a decoder may be performed usingfor example a media storage device such as an optical disc.

In one or more embodiments of the invention a video image is transmittedwith data representative of compensation offsets for application toreconstructed pixels of the image to provide filtered pixels in a finalimage.

FIG. 6 schematically illustrates a processing device 600 configured toimplement at least one embodiment of the present invention. Theprocessing device 600 may be a device such as a micro-computer, aworkstation or a light portable device. The device 600 comprises acommunication bus 613 connected to:

-   -   a central processing unit 611, such as a microprocessor, denoted        CPU;    -   a read only memory 607, denoted ROM, for storing computer        programs for implementing the invention;    -   a random access memory 612, denoted RAM, for storing the        executable code of the method of embodiments of the invention as        well as the registers adapted to record variables and parameters        necessary for implementing the method of encoding a sequence of        digital images and/or the method of decoding a bitstream        according to embodiments of the invention; and    -   a communication interface 602 connected to a communication        network 603 over which digital data to be processed are        transmitted or received

Optionally, the apparatus 600 may also include the following components:

-   -   a data storage means 604 such as a hard disk, for storing        computer programs for implementing methods of one or more        embodiments of the invention and data used or produced during        the implementation of one or more embodiments of the invention;    -   a disk drive 605 for a disk 606, the disk drive being adapted to        read data from the disk 606 or to write data onto said disk;    -   a screen 609 for displaying data and/or serving as a graphical        interface with the user, by means of a keyboard 610 or any other        pointing means.

The apparatus 600 can be connected to various peripherals, such as forexample a digital camera 620 or a microphone 608, each being connectedto an input/output card (not shown) so as to supply multimedia data tothe apparatus 600.

The communication bus provides communication and interoperabilitybetween the various elements included in the apparatus 600 or connectedto it. The representation of the bus is not limiting and in particularthe central processing unit is operable to communicate instructions toany element of the apparatus 600 directly or by means of another elementof the apparatus 600.

The disk 606 can be replaced by any information medium such as forexample a compact disk (CD-ROM), rewritable or not, a ZIP disk or amemory card and, in general terms, by an information storage means thatcan be read by a microcomputer or by a microprocessor, integrated or notinto the apparatus, possibly removable and adapted to store one or moreprograms whose execution enables the method of encoding a sequence ofdigital images and/or the method of decoding a bitstream according tothe invention to be implemented.

The executable code may be stored either in read only memory 607, on thehard disk 604 or on a removable digital medium such as for example adisk 606 as described previously. According to a variant, the executablecode of the programs can be received by means of the communicationnetwork 603, via the interface 602, in order to be stored in one of thestorage means of the apparatus 600 before being executed, such as thehard disk 604.

The central processing unit 611 is adapted to control and direct theexecution of the instructions or portions of software code of theprogram or programs according to the invention, instructions that arestored in one of the aforementioned storage means. On powering up, theprogram or programs that are stored in a non-volatile memory, forexample on the hard disk 604 or in the read only memory 607, aretransferred into the random access memory 612, which then contains theexecutable code of the program or programs, as well as registers forstoring the variables and parameters necessary for implementing theinvention.

In this embodiment, the apparatus is a programmable apparatus which usessoftware to implement the invention. However, alternatively, the presentinvention may be implemented in hardware (for example, in the form of anApplication Specific Integrated Circuit or ASIC).

FIG. 7 illustrates a block diagram of an encoder according to at leastone embodiment of the invention. The encoder is represented by connectedmodules, each module being adapted to implement, for example in the formof programming instructions to be executed by the CPU 611 of device 600,at least one corresponding step of a method implementing at least oneembodiment of encoding an image of a sequence of images according to oneor more embodiments of the invention.

An original sequence of digital images i0 to in 701 is received as aninput by the encoder 70. Each digital image is represented by a set ofsamples, known as pixels.

A bitstream 710 is output by the encoder 70 after implementation of theencoding process. The bitstream 710 comprises a plurality of encodingunits or slices, each slice comprising a slice header for transmittingencoding values of encoding parameters used to encode the slice and aslice body, comprising encoded video data.

The input digital images i0 to in 701 are divided into blocks of pixelsby module 702. The blocks correspond to image portions and may be ofvariable sizes (e.g. 4×4, 8×8, 16×16, 32×32, 64×64 pixels). A codingmode is selected for each input block. Two families of coding modes areprovided: coding modes based on spatial prediction coding (Intraprediction), and coding modes based on temporal prediction (Intercoding, Merge, SKIP). The possible coding modes are tested.

Module 703 implements an Intra prediction process, in which the givenblock to be encoded is predicted by a predictor computed from pixels ofthe neighbourhood of said block to be encoded. An indication of theselected Intra predictor and the difference between the given block andits predictor is encoded to provide a residual if the Intra coding isselected.

Temporal prediction is implemented by motion estimation module 704 andmotion compensation module 705. Firstly a reference image from among aset of reference images 716 is selected, and a portion of the referenceimage, also called reference area or image portion, which is the closestarea to the given block to be encoded, is selected by the motionestimation module 704. Motion compensation module 705 then predicts theblock to be encoded using the selected area. The difference between theselected reference area and the given block, also called a residualblock, is computed by the motion compensation module 705. The selectedreference area is indicated by a motion vector.

Thus in both cases (spatial and temporal prediction), a residual iscomputed by subtracting the prediction from the original block.

In the INTRA prediction implemented by module 703, a predictiondirection is encoded. In the temporal prediction, at least one motionvector is encoded.

Information relative to the motion vector and the residual block isencoded if the Inter prediction is selected. To further reduce thebitrate, assuming that motion is homogeneous, the motion vector isencoded by difference with respect to a motion vector predictor. Motionvector predictors of a set of motion information predictors is obtainedfrom the motion vectors field 718 by a motion vector prediction andcoding module 717.

The encoder 70 further comprises a selection module 706 for selection ofthe coding mode by applying an encoding cost criterion, such as arate-distortion criterion. In order to further reduce redundancies atransform (such as DCT) is applied by transform module 707 to theresidual block, the transformed data obtained is then quantized byquantization module 708 and entropy encoded by entropy encoding module709. Finally, the encoded residual block of the current block beingencoded is inserted into the bitstream 710.

The encoder 70 also performs decoding of the encoded image in order toproduce a reference image for the motion estimation of the subsequentimages. This enables the encoder and the decoder receiving the bitstreamto have the same reference frames. The inverse quantization module 711performs inverse quantization of the quantized data, followed by aninverse transform by reverse transform module 712. The reverse intraprediction module 713 uses the prediction information to determine whichpredictor to use for a given block and the reverse motion compensationmodule 714 actually adds the residual obtained by module 712 to thereference area obtained from the set of reference images 716.

Post filtering is then applied by module 715 to filter the reconstructedframe of pixels. In the embodiments of the invention an SAO loop filteris used in which compensation offsets are added to the pixel values ofthe reconstructed pixels of the reconstructed image

FIG. 8 is a flow chart illustrating steps of loop filtering processaccording to at least one embodiment of the invention. In an initialstep 801, the encoder generates the reconstruction of the full frame.Next, in step 802 a deblocking filter is applied on this firstreconstruction in order to generate a deblocked reconstruction 803. Theaim of the deblocking filter is to remove block artifacts generated byresidual quantization and block motion compensation or block Intraprediction. These artifacts are visually important at low bitrates. Thedeblocking filter operates to smooth the block boundaries according tothe characteristics of two neighboring blocks. The encoding mode of eachblock, the quantization parameters used for the residual coding, and theneighboring pixel differences in the boundary are taken into account.The same criterion/classification is applied for all frames and noadditional data is transmitted. The deblocking filter improves thevisual quality of the current frame by removing blocking artifacts andit also improves the motion estimation and motion compensation forsubsequent frames. Indeed, high frequencies of the block artifact areremoved, and so these high frequencies do not need to be compensated forwith the texture residual of the following frames.

After the deblocking filter, the deblocked reconstruction is filtered bya sample adaptive offset (SAO) loop filter in step 804 based on aclassification of pixels 814 determined in accordance with embodimentsof the invention. The resulting frame 805 may then be filtered with anadaptive loop filter (ALF) in step 806 to generate the reconstructedframe 807 which will be displayed and used as a reference frame for thefollowing Inter frames.

In step 804 each pixel of the frame region is classified into a class ofthe determined classification according to its pixel value. A classcorresponds to a determined range of pixel values. The same compensationoffset value is added to the pixel value of all pixels having a pixelvalue within the given range of pixel values.

The determination of the classification of the pixels for the sampleadaptive offset filtering will be explained in more detail hereafterwith reference to any one of FIGS. 10 to 17.

FIG. 9 illustrates a block diagram of a decoder 90 which may be used toreceive data from an encoder according an embodiment of the invention.The decoder is represented by connected modules, each module beingadapted to implement, for example in the form of programminginstructions to be executed by the CPU 611 of device 600, acorresponding step of a method implemented by the decoder 90.

The decoder 90 receives a bitstream 901 comprising encoding units, eachone being composed of a header containing information on encodingparameters and a body containing the encoded video data. As explainedwith respect to FIG. 7, the encoded video data is entropy encoded, andthe motion vector predictors' indexes are encoded, for a given block, ona predetermined number of bits. The received encoded video data isentropy decoded by module 902. The residual data are then dequantized bymodule 903 and then a reverse transform is applied by module 904 toobtain pixel values.

The mode data indicating the coding mode are also entropy decoded andbased on the mode, an INTRA type decoding or an INTER type decoding isperformed on the encoded blocks of image data.

In the case of INTRA mode, an INTRA predictor is determined by intrareverse prediction module 905 based on the intra prediction modespecified in the bitstream.

If the mode is INTER, the motion prediction information is extractedfrom the bitstream so as to find the reference area used by the encoder.The motion prediction information is composed of the reference frameindex and the motion vector residual. The motion vector predictor isadded to the motion vector residual in order to obtain the motion vectorby motion vector decoding module 910.

Motion vector decoding module 910 applies motion vector decoding foreach current block encoded by motion prediction. Once an index of themotion vector predictor, for the current block has been obtained theactual value of the motion vector associated with the current block canbe decoded and used to apply reverse motion compensation by module 906.The reference image portion indicated by the decoded motion vector isextracted from a reference image 908 to apply the reverse motioncompensation 906. The motion vector field data 911 is updated with thedecoded motion vector in order to be used for the inverse prediction ofsubsequent decoded motion vectors.

Finally, a decoded block is obtained. Post filtering is applied by postfiltering module 907 similarly to post filtering module 815 applied atthe encoder as described with reference to FIG. 8. A decoded videosignal 909 is finally provided by the decoder 90.

FIG. 10 is a flow chart illustrating steps of a method according to afirst embodiment of the invention for classifying reconstructed pixelsof an image for application of compensation offsets. In this embodiment,classes for classification of the reconstructed pixels of the frameregion according to their pixel value are determined based on thestatistical distribution of the reconstructed pixel values of the frameregion. The center, the useful range and the amount of pixels per classare determined based on the distribution of pixel values. In thisembodiment, the decoder can apply exactly the same process as thedecoder for the segmentation of the distribution.

In an initial step of the process module 1002 scans a current frame area1001 in order to determine statistical distribution of the pixel valuesof the pixels of the frame area 1001 and to generate a correspondinghistogram 1003. In one particular embodiment this process involvesupdating a table which contains the number of pixels for each pixelvalue i.e. for each pixel value, the number of pixels having that pixelvalue is tabulated. The table contains a number of cells equal to MAXthe maximum pixel value determined according to the expressionMax=2^(Bitdepth)−1, based on the bit-depth of the pixels.

Module 1004 then determines the center of the generated histogram 1003.The useful range of pixel values of the histogram is then determined bymodule 1006 according to the distribution of the pixel valuesrepresented in histogram 1003 and where appropriate based on the centerof the histogram. Finally, the equiprobable classes defining ranges ofpixel values are determined. A table 1009 is thus provided containingthe range of pixel values of each class or alternatively table whichcontains the pixel values of each pixel. In some embodiments of theinvention the determination of equiprobable classes can depend on apre-determined number of classes 1000.

In step 1004 various algorithms may be employed to determine the centerof the generated histogram 1003. In one embodiment, the minimum valueMin_(Hist) and the maximum value Max_(Hist) of the histogram may befound. In order to find the minimum value Min_(Hist), the cells of thehistogram Hist_(k) are scanned from pixel value 0 to the first cellHist_(k) of the histogram which is not equal to 0. And to findMax_(Hist), the cells are scanned in inverse order (from the maximumpixel value MAX to the first cell of the histogram Hist_(k) which is notequal to 0). The center of the histogram Center_(Hist) is computed asfollows:

Center_(Hist)=(Max_(Hist)−Min_(Hist))/2+Min_(Hist)

In an alternative embodiment, the center of the histogram is consideredto be the weighted average center of the distribution. If it isconsidered that the value of histogram cell Hist_(k) is the number ofpixels which have the value k, Center_(Hist) is computed as follows:

${Center}_{Hist} = \frac{\sum\limits_{k = 0}^{MAX}{k \times {Hist}_{k}}}{N}$

where N is the number of pixels in the current frame area.

In step 1006 one potential technique for determining the useful range ofthe generated histogram is to select Min_(Hist) and Max_(Hist) describedabove for both ends of the useful range.

In another embodiment the minimum value of the histogram Min_(Range) isdetermined by a scanning from 0 to the first Hist_(k) which has a valuesuperior to a threshold α. In the same way, Max_(Range) is determined byinverse scanning from the maximum pixel value MAX to the first Hist_(k)which is superior to a threshold α. The threshold α may be apredetermined value. Alternatively the threshold α may depend on thenumber of pixels in the frame area and/or on the component type of theinput signal (Chroma and Luma).

In one particular embodiment, it may be considered that the number ofclasses is known at the encoder and decoder side. The number of classesof pixel values may depend, for example, on the number of pixels in thecurrent frame area according to each component (Luma, Chroma U and V).

In order to produce equiprobable classes, the number of pixelsNbPix_(Range) in the useful range 1007 is defined. The number of pixelsin the useful range NbPix_(Range) is determined by scanning eachhistogram cell Hist_(k) from k=Min_(Range) to k=Max_(Range). Then, thedetermined number of pixels in the useful range, NbPix_(Range), isdivided by the number of classes 1000 to determine the optimal number ofpixels in each class NbPix_(classes).

FIG. 11 is a flow chart illustrating steps of an algorithm fordetermining equiprobable classes according to an embodiment of theinvention. In an initial step 1101, the number of classes j is set to 0and the current pixel value k is set to Min_(Range). For equiprobableclassification, a class is identified by its range of pixel values. Theclass number j is thus identified by its range └Min_(j);Max_(j)┘ fromits minimum pixel value Min_(j) to its Maximum pixel value Max_(j).

In step 1103, the minimum pixel value Min_(j) of current class indexedby j is set to the current pixel value k. Then SumNbPix_(j) is set to 0in step 1104. SumNbPix_(j) corresponds to the number of pixels in therange j. Then, the number of pixels having pixel value k (Hist_(k)) isadded to SumNbPix_(j) in step 1105. In step 1106 it is determinedwhether or not the sum of the number of pixels for the current class jSumNbPix_(j) is superior to the number of pixels in classesNbPix_(classes). If this condition is not reached, the k value isincremented in step 1107 and the number of pixels Hist_(k) for the pixelvalue k is added to SumNbPix_(j) in step 1105. If it is determined thatSumNbPix_(j)>NbPix_(classes) or if k reaches the maximum value of theuseful range Max_(Range), the maximum value for the current class j isequal to the current value of k in step 1108. At this stage, class j isdefined—i.e. the range └Min_(j);Max_(j)┘ of class j has been determined.The variable k is incremented in step 1109 in order to avoid obtainingthe same pixel value in more than one class. Moreover, the variable j isalso incremented in step 1110 in order to define the range of pixelvalues for the next class. If the variable j is superior to the numberof classes NbPix_(classes) then it may be considered that all classeshave been defined in step 1112.

As a consequence the encoder will determine the offset value for eachclass j as described in relation to FIG. 3 and transmit it to thedecoder. The encoder and decoder will filter the frame area as describedin reference to FIG. 4.

It may be noted that in this embodiment, the number of classes NbClassesdoes not depend on the pixel values because the number of classes ispre-determined based on a syntax value. Consequently in this embodiment,the parsing of the SAO band offset is independent of the decoding of theother frames. It may be noted that the parsing for SAO band offsetincludes the parsing of each offset.

In a further embodiment for determining equiprobable classification, thenumber of classes can be determined according to the distribution ofpixel values in the generated histogram. Indeed, when the amplitude ofthe useful range is high or low, the number of classes should have animpact on the coding efficiency. Consequently, a better adaptableclassification may be provided by determining the number of pixels ineach class as well as the number of pixel values.

FIG. 12 is a flow chart illustrating steps of an algorithm according toa further embodiment for providing a more adaptable classification. Thisflow chart is based on the flow chart of the embodiment of FIG. 11 wherelike end numbered modules perform equivalent functions. However decisionmodules 1206 and 1211 of this embodiment operate different testconditions from the test conditions operated by corresponding modules1106 and 1111 of FIG. 11.

In this embodiment decision module 1206 stops the loop based on k valuesand selects Max_(j) for class j, if SumNbPix_(j)>NbPix_(classes) OR if kreaches the maximum value of the useful range Max_(Range) OR ifk−Min_(j) is strictly lower than the maximum range for a class(MaxClass_(Range)). k−Min_(j) corresponds to the number of pixel valuesin the current range of class j. MaxClass_(Range) is a predeterminedmaximum number of pixel values in the range. This range may depend onthe bit-depth, the number of pixels N in the frame area and the type ofsignal (Luma, Chroma U and V). For example, when the bit-depth is 8,MaxClass_(Range) for Luma component could be equal to 16 as in a HEVCimplementation.

The advantage of the embodiment of FIG. 12 compared to that of FIG. 11,is that it's coding efficiency for a pixel value distribution with largeamplitude. This embodiment is more adaptable to the distribution.

It may be noted that in this embodiment, the determined number ofclasses depends on the pixel values, and so the parsing of the currentframe depends on the decoding of the previous frames. In order to bemore robust to transmission errors, the number of classes NbClasses isinserted into the bitstream. The transmission of such data has aninsignificant impact on coding efficiency.

The main advantage of the first embodiment of classification of FIGS. 10to 12 is that the classification is adapted to the pixel valuesdistribution. Moreover the center, the useful range and the size of eachclass and their amount do not need to be transmitted. Consequently as inthe known HEVC implementation no additional data apart from datarepresentative of the offset of each class needs to be transmitted forthe determined classification.

A further embodiment of the invention for determining a classificationand which involves signaling of parameters of the classification willnow be described with reference to FIG. 13. The purpose of the furtherembodiment of classification is to provide an optimal classification ofthe distribution of pixel values. The difference compared to theprevious embodiment is that the classification is not directlydetermined based on the distribution of pixel values but on ratedistortion criterion. In the further embodiment, the encoder selects theclassification, best adapted to the pixel values distribution, fromamong predefined potential classifications. This selection is based onthe rate distortion criterion. As in previous embodiments, the center,the useful range and the size of classes of the generated histogramrepresenting the distribution of pixel values are determined. In thefurther embodiment these parameters are transmitted in the bitstream. Inorder to minimize the impact of the transmission of such data, the sizesof the classes and the related ranges are selected from among predefinedvalues. Consequently, the encoder inserts the center of the selectedclassification, the index related to the selected classification and thesizes of the classes of the classification into the bitstream.

To provide an adaptation to the distribution of pixel values, severalsizes of pixel value ranges are defined as depicted in FIG. 13. In FIG.13, the full range of pixel values is divided into 32 sub-ranges. For afirst group of classes relating to pixel values located in the center ofthe range of pixel values, 4 examples are represented 1301, 1302, 1303,1304. The first example 1301 contains 26 ranges out of the potential 32ranges. Thus, the useful range 1301 represents 13/16th of the fullrange. In the same way, 1302 represents only 8 ranges out of 32potential ranges, i.e. ¼th of the useful range, 1303 represents ⅛th ofthe full range and 1304 1/16th of the full range. For the proposedscheme, all possible sizes from the full range to a range correspondingto only one pixel value may be considered. The number of possible usefulranges should be pre-determined according to the coding efficiency or tothe pre-determined for the number of pixels in the frame area.

FIG. 13 also shows several examples of sizes for the second group ofclasses relating to pixel values located at the edges of the range ofpixel values. The second group includes two sub-group of classes, onelocated towards each edge of the histogram. Examples 1305, 1306, 1307,1308 represent respectively the same number of pixel values as examples1301, 1302, 1303, 1304 of the first group.

In embodiments of the invention, the size of classes i.e. the range ofpixel values per class, is not fixed, compared to prior art methods.FIG. 14 shows examples of several sizes 1401 to 1406. In this example,the class sizes are from 32 pixels 1401 to only 1 pixel 1406. Theseclass sizes could be combined with all the possible useful ranges asdescribed previously in relation to FIG. 13. In this embodiment, it isconsidered that all classes have the same size for a specific range ofpixel values. Thus, for a group, data representative of the useful rangesize and the size of classes are inserted into the bitstream.

In another embodiment, the sizes of classes for a given useful range areadapted according to the position of the class in the useful range. Moreprecisely, the sizes of the class are adapted to the distribution of thepixel values. In the further embodiment, these sizes are predeterminedfor each useful range according to the pixel value distribution. Indeed,the histogram of the pixel value distribution generally corresponds to aGaussian distribution. The closer to the center of the histogram a pixelvalue is, the more numerous the pixels having a pixel value close tothis value are. It means that a histogram cell Hist_(k) close to thecenter has a greater value (number of corresponding pixels) than ahistogram cell Hist_(k) at both ends of the useful range of thehistogram.

FIG. 15 shows examples of the two described embodiments for the sizes ofclasses. Example 1501 represents a fixed size of 8 pixel values for auseful range of 32 pixel values. 1502 represents a fixed size of 4 pixelvalues for the same useful range size.

Example 1503 illustrates the other embodiment for adaptive sizes ofclasses for a current range of 32 pixel values. In this example, theclasses at both ends of the useful range are larger i.e. have a widerrange of pixel values, than the classes in the center with respectively8 pixel values and 2 pixel values. Between these classes, the 2 otherclasses have a range of 4 pixel values.

The sizes of classes for the second group can also be adapted to thedistribution of pixel values. The aim of the second group of the currentHEVC implementation is to exploit only the two ends of the histogram.Indeed, both ends of the histogram contain the extreme values which areoften related to high frequencies where the error (due to the lossycoding) is usually higher compared to low frequencies. In the same wayas in the first group, several sizes of classes can be tested for theuseful ranges of the second group. In that case, for the two sub-groupsof the second group, subdivisions 1501 and 1502 can be compared with therate distortion criterion.

Moreover, the embodiment in which the sizes of classes are adapted maybe applied. Example 1504 illustrates the proposed adapted sizes ofclasses for the first range (left) of the second group. And example 1505illustrates the proposed adapted sizes of classes for the secondsub-group (right) of the second group. In that case, the classes containmore pixel values at both ends than the classes close to the center.

The aim of the second group is to exploit both ends of the histogram;consequently, it is sometimes useful to use an inverse adaptation ofsizes for the second group. In that case, example 1504 is used for thesecond sub-group (right) and example 1505 is used for the firstsub-group (left) of the second group. In this embodiment, the classescontain less pixel values at both ends than the classes close to thecenter. In that case, the aim is not to produce an equiprobableclassification of classes but to find a better segmentation of both endsof the second group.

Since the statistical distribution of pixel values is not necessarilycentered in the middle of the full range of pixel values, a center ofthe distribution based on the useful range should to be determined andtransmitted in the bitstream with the image data. FIG. 16 shows anexample of a full range with different center positions for a usefulrange corresponding to one quarter of the full range. As opposed to theexample 1302 of FIG. 13, for the four examples of FIG. 16, 1601, 1602,1603, 1604 the center of the useful range is not located in the centerof the full range. This solution allows the selected classification tobe adapted to the distribution of the pixel values.

The determined center can then be coded for transmission in thebitstream. Several techniques can be envisaged for coding of the data.

If it is considered that the bit-depth of the current frame area is 8bits, the number of positions that could be considered for the centervalue corresponds to 256 minus the size of the minimum useful range. Forexample, compared to FIG. 13, the minimum size of the useful range isequal to 2 and these 2 classes may contain at least 1 pixel. So for thisspecific example, the center can take a value between 1 to 254, thus 254positions may be considered for the center.

Another solution is to quantify the center value. In one embodiment, thecenter is coded according to the size of classes. Thus, for example ifthe size of classes (or the minimum size of all classes of a currentuseful range when the adapted class size scheme is used) is equal to onepixel value, the center is not quantified and can be all possible centerpositions for the current useful range. If the size of the classes is 16pixel values, as depicted in FIG. 16, only the pixel values every 16pixel values can be considered. Thus, in FIG. 16, the center forexamples 1601, 1602, 1603 and 1604 are respectively 9, 23, 27 and 6. Inanother embodiment, only the center positions equal to a multiple of themaximum size of classes defined in the algorithm may be considered.Thus, the center is equal to a pixel value divided by the maximum sizeof classes. This offers a reduction in terms of number of bits to betransmitted.

Moreover, theoretically, the most probable center is the center of thefull range. Thus, the data transmitted to determine the center positionat the decoder side is the difference between the center of the fullrange and the center of the useful range of the current classification.Thus, for example in FIG. 16, the data transmitted relative to thecenter for examples 1601, 1602, 1603, 1604 are respectively 16−9=7,16−23=−7, 16−27=−11, 16−6=10.

For the second group, the center of the histogram does not need to becoded. Thus, several schemes can be considered to code the displacementof the two sub-groups for the second group. The proposed embodiments onthe quantization of the center value described for the first group canbe easily extended to the proposed embodiments for the second group.

In embodiments of the invention the position of the useful range(selected classification) may be specified with the same precision orgranularity across the full range, i.e. irrespective of the position ofthe classification within the full range. This is the case in theexamples 1601 to 1604 shown in FIG. 16, where the positions (centerpositions) are 9, 23, 27 and 6. The full range is labeled from 0 to 32.There are 32 possible positions and the granularity is the same acrossthe full range.

However, it is also possible, as shown in FIGS. 19 a and 19 b to providemore possible positions in one part of the full range than in anotherpart of the full range, In other words, the granularity of the positionvaries in dependence on where the classification is within the fullrange. These embodiments propose an unequal quantization of the fullrange (here labeled from 0 to 32) with a variable granularity in orderto position more precisely the center of the classification (usefulrange) in the most important (or likely) parts of the full range. Also,the unequal quantization enables the number of bits required to signalthe position of the classification to be limited whilst still givingadequate precision in the important parts of the full range. This finergranularity could be applied for instance in the middle of the fullrange as represented in FIG. 19 a. In this figure, the possible centerpositions correspond to indexes which are represented by a bold solidline. The interval between two possible center positions is smaller inthe middle of the full range than at the ends. Thus the center positioncan be set more precisely in the middle of the full range than at theends of the full range.

In FIG. 19 b the interval between two possible center positions issmaller at both ends of the full range than in the middle. For example,this embodiment can be particularly useful in case of having importantsample values at extreme values of the distribution.

More generally, a finer quantization could be applied at any place inthe full range.

When variable quantization as described above is used the classificationrange (size of the useful range) can be fixed for all positions. Forinstance, the classification range can comprise four classes, each madeof 8 pixel values.

It is also possible to make the classification range/class sizes varywith position, so that in FIG. 19 a the classification range is, say, 8pixel values at positions 12 to 20, 16 pixel values at positions 10 and26, and 32 pixel values at positions 2 and 28.

The variable quantization as described here can be used regardless ofthe method applied for determining the classification range. This methodcan for instance use the properties of the statistical distribution ofsample values or use a rate-distortion criterion.

The variable quantization could be predetermined both at the encoder andat the decoder. For example, the encoder and decoder could assignindexes to the possible center positions (or left positions), e.g. inFIG. 19 a position 2 is index 0, position 6 is index 1, position 10 isindex 2, position 12 is index 3, position 13 is index 4, etc. Then, itis sufficient for the encoder to transmit to the decoder the index ofthe selected classification. Alternatively, information about thevariable quantization could be determined at the encoder and signaled tothe decoder via a bitstream.

In one particular embodiment, it may be considered that the center ofthe histogram is always the center of the full range. Thus, in that caseonly one displacement is considered. Both groups are scaled to thecenter with the same displacement. Consequently only one data needs tobe coded: the displacement of the first range of the second group.Examples 1701, 1702, 1703 and 1704 of FIG. 17 are examples of suchdisplacements. In examples 1701, 1702, 1703, 1704 the displacements arerespectively 4, 6, 10 and 0. The displacement can be directly codedwithout prediction.

In a further embodiment, both sub-groups of the second group have anindependent position in the full range as depicted in examples 1705,1706, 1707 and 1708. Two ways of coding can be considered.

In the first one, the center of a non-existent first group is coded withthe size of the useful range of this non-existent first group.

The second way of coding independently both groups, is to transmit 2displacements from the two ends of the full range (one for each group).Thus, for examples 1705, 1706, 1707 and 1708, the displacementtransmitted is respectively 11 and 32−28=4 for 1705, 21 and 0 for 1706,3 and 32−16=32 for 1707, 7 and 32−31=1 for 1708.

FIG. 18 is a flow chart illustrating steps of a rate distortionselection algorithm according to an embodiment of the invention. Forsimplified explanatory purposes only selection for the first groupwithout adapted class sizes is considered. The selection for the otherembodiments described previously can be easily adapted.

In an initial step 1801, the statistics of the current frame area arecomputed. This involves determining variables Hist_(k) and Sum_(k) forall pixel values k. Hist_(k) corresponds to the number of pixels havinga pixel value equal to the value k and Sum_(k) corresponds to the sum ofdifferences between all pixels having a pixel value equal to value k andtheir original pixel values. The algorithm includes 3 loops on threeparameters: size of classes S, size of range R and the center C. Thefirst loop tests each possible class size in step 1803. For example, thesize defined in FIG. 14. The offset for each sub-range of the full rangeis computed in step 1804. For example, if the bit-depth is 8 and thesize of classes is 16, then the distortion and the offset for the 32possible ranges in the full range are computed. By properties, theoffset and the distortion are computed by linear combination of Hist_(k)and Sum_(k) for all values of k in the current range. Then, for eachpossible range R 1805, and each possible centers C 1806 a ratedistortion cost is evaluated in step 1807. This evaluation is based onthe rate distortion criterion. When all centers C 1808, all ranges 1809and all sizes 1810 are tested, the best parameters S, R, C are selectedin step 1811 based on the best rate distortion cost. The advantages ofthis second scheme to produce an equiprobable classification include areduction of complexity and an improvement in coding efficiency. Theclassification selection of the center, range and size of classes offersan optimal rate distortion selection compared to embodiments whereclassification is based on the statistical distribution of pixel values.Of course this embodiment gives an improvement in term of codingefficiency compared to the current HEVC implementation. This scheme isless complex at decoder side compared to the previous one since thedistribution of pixels does not need to be determined at the decoder.Moreover, this scheme can be less complex than known techniques in HEVCbecause in some groups fewer classes are used.

The algorithm represented in FIG. 18, performs a full rate distortionbased selection of all band offset parameters: the size of classes S,the range R, the position of a value representative of the center C. Inorder to limit the complexity, it is possible to fix some parameters. Inone particular implementation of the algorithm of FIG. 18, the size Sand the range R are fixed at given values known by the encoder and thedecoder. For instance S could represent 8 pixel values and R couldrepresent 32 pixel values corresponding to 4 classes of 8 pixels. As aconsequence the only parameter to be optimized is the valuerepresentative of the center C.

Since embodiments of the invention take into account the repartition ofpixel values across the range of pixel values in the determination ofthe classification of the pixels, the classification may be adaptedaccordingly to different distributions of pixel values. In particularthe classification can be adapted according to the component type of thepixels. For example, in the case of a set of Chroma component pixels thepixel values tend to be lower compared to the pixel values of Lumachroma pixels. In addition, Chroma U pixel values have a differentdistribution to that of Chroma V pixel values which have moreconcentrated and relatively higher pixels values. Moreover, in the caseof chroma component pixels the distribution of pixel values tends to bemore concentrated around peak pixel values compared to that of Lumachroma pixels which provides a more widely spread out distribution.

As seen above, in order to avoid the determination of the distributionof pixels at the decoder side, the parameters S, R and C are transmittedin the bitstream in addition to the SAO type (No SAO, edge offset orband offset) and the compensation offset values. When the class size andthe range are fixed, only C is transmitted in order to allow a decoderto retrieve the center of the range.

In the case of fixed S and R, one known solution to encode the SAOparameters consists in applying the pseudo code of FIG. 20A, describedin the form of a flow chart by FIG. 21.

The process starts by the determination of the SAO parameters, includingthe type of SAO (stored in the codeword sao_type_idx), the valuerepresentative of the center of the useful range (stored in the codewordsao_band_position) when the band offset type is used, and the SAOoffsets (stored in the codewords sao_offset). In FIG. 20A, cldxrepresents the index of the color component to which SAO is applied, rxand rx represent the position of the area to which SAO is applied, and iis the index of the class of sample values.

The SAO parameters encoding starts then at step 2003 with the encodingof the SAO type using an unsigned Exp Golomb code (ue(v))(i.e. unsignedvariable length code). If the SAO type is type 5 (band offset), theencoding continues with the encoding of the value representative of theposition of the center of the useful range using an unsigned fixedlength code of size 5 (u(5)) at step 2017. Then, the encoding of thefour offsets corresponding to the four classes contained in the range isperformed iteratively in steps 2019 to 2025. Here, each offset isencoded using a signed Exp Golomb code (se(v))(i.e. signedvariable-length-coding (VLC) code). The encoding process then ends withstep 2027.

If the SAO type is not band offset, we check first if the SAO type is noSAO (no SAO means no offset is applied to the samples concerned). If noSAO has been selected, the encoding process stops in step 2027.

Otherwise, we continue with the iterative encoding of the four edgeoffsets in steps 2007 to 2013. Again, the encoding process stops in step2027.

VLC codes are generally used when the range of values to represent isrelatively high but some values in this range are more probable thanothers. Most probable values are then given a short code, while lessprobable values are given a long code. The main drawback of these codesis that they induce a higher decoding complexity than fixed length codes(FLC). Indeed, a VLC code has to be read bit by bit since the final sizeof the code is not known while all bits of a FLC code can be readdirectly since its size is known.

In FIGS. 20B and 22, we propose an alternative to this encoding processreplacing VLC codes by FLC codes.

This encoding process starts with step 2201 which is identical to step2001. In step 2203, the VLC coding of the codeword sao_type_idx isreplaced by a FLC encoding. 3 bits are necessary here to encode the 6possible SAO type values (i.e. the “no SAO” type, the 4 “edge offset”types, and the “band offset” type). We then check if the type of SAO is“no SAO”. In that case, nothing more is encoded and the process endswith step 2215. Otherwise, we check if the type of SAO is “band offset”.If yes, the value representative of the position of the center of therange is encoded in the codeword SAO_band_position in the form of anunsigned FLC code of size 5. Indeed, in this example, with a class sizeof 8 sample values and a range made up of four classes, 28 differentpositions are possible for a full range of 256 values.

This step is followed by the encoding of the four SAO offsets in steps2211 to 2213. Here a FLC code replaces the VLC code of step 2023 and2011. Instead of using a VLC code of maximum 5 bits covering integeroffset values from −31 to 32, here we use a FLC code of size 2 bitscapable of encoding only 4 different values, generally (−2, −1, 1, 2).Reducing the number of possible values has the effect of concentratingthe encoding on the most frequently used offset values.

The process stops after the offset encoding in step 2215.

Note that, in another embodiment, the range represented by the offsetscan be extended by encoding in a picture header, a slice header or a LCUheader, a multiplication factor to be applied to the offsets obtained bythe 2 bits code. For instance with a multiplication factor equal to 4,the encoded offsets (−2, −1, 1, 2), become (−8, −4, 4, 8). Themultiplication factor can also be standardized (fixed) or be inferredfrom another LCU. For example, the multiplication factor applicable to aprevious LCU may be assumed to apply to the present LCU.

Similarly in another embodiment, a shifting value, encoded in a pictureheader, a slice header or a LCU header, could be applied to the offsetsobtained by the 2 bits code. For instance with a shifting value of 5,the encoded offsets (−2, −1, 1, 2), become (3, 4, 6, 7). Again, theshifting value can also be standardized (fixed) or be inferred fromanother LCU. For example, the shifting value applicable to a previousLCU may be assumed to apply to the present LCU.

Tests have shown that having fewer possible offset values does notreduce the performance of the SAO method significantly. It appears thatthe loss induced by the suppression of some offset values is compensatedby the suppression of the heavy bitrate cost of less probable offsetvalues.

Additional tests have also shown that the number of different offsetvalues can be further reduced to 3 and even 2 offsets (requiring onlyone bit to encode) without significant loss of performance.

In FIG. 23, a further improvement of the encoding process is proposed.We consider here that the offset values used in the case of the edgeoffset type, can be inferred directly from the type of edge offset. Inthat case no encoding of the edge offset values is required. As areminder, each type of edge offset is associated with 4 classesdepending on the signal direction, and each class has an associatedoffset value. This embodiment is motivated by tests showing that ingeneral for a given edge offset type and a given class, the offsetvalues are close to each other and generally the same. As a consequence,we propose to fix for each edge offset type a set of 4 offset values.For instance we propose the following association:

-   -   Vertical edge offset: (−2, −1, 1, 2)    -   Horizontal edge offset (−2, −1, 1, 3)    -   First diagonal edge offset (−3, −2, −1, 1)    -   Second diagonal edge offset (−1, 1, 2, 3)

Steps 2301 and 2303 in FIG. 23 are identical to steps 2201 and 2203already explained with reference to FIG. 22. In steps 2305 and 2307, wecheck if the SAO type is “edge offset” or “no SAO” respectively. In bothcases, no offsets are encoded. In the case that the SAO type is “edgeoffset”, when reading the edge offset type value, a decoder will inferthe offset values from the edge offset type thanks to the knownassociation with fixed offset values.

In the embodiment of FIG. 23, if the SAO type is “band offset” the valuerepresentative of the position of the center of the range is encoded instep 2309 and the four offset values are encoded iteratively with steps2311 to 2317. The encoding process ends with step 2319.

In the embodiment of FIGS. 24 and 25 we apply another modification ofthe encoding process described in FIGS. 20A and 21. As already mentionedin previous embodiment, a FLC code of 5 bits is used to encode theinformation representative of the position of the center of the range(sao_band_position), while only 28 different positions are used. In thatcondition, four FLC codes each of length 5 bits remain unused. Wepropose here to take benefit of these four spare FLC codes to remove thecodeword used to encode the SAO type. A new codeword,SAO_band_position_and EO will be used to code jointly the rangepositions and the edge offset types. This new codeword is also 5 bitslong.

As usual, the process starts in step 2501 with the definition of the SAOparameters. This process is followed in step 2503 by the encoding of a 1bit long flag (SAO_LCU_flag) indicating if SAO is in use or not. If SAOis not used (step 2505), the process stops (step 2507).

If SAO is used, we check in step 2509 which type of SAO is used. If theSAO type is “band offset” then in step 2513 the first 28 codes of thecodeword SAO_band_position_and_EO are used to encode the valuerepresentative of the position of the center of the range. If the SAOtype is “edge offset”, then in step 2511 the last four codes of thecodeword SAO_band_position_and_EO are used to encode the type of edgeoffset (vertical, horizontal, first diagonal or second diagonal). Thesteps 2511 or 2513 are followed by the encoding of the four offsetvalues with steps 2515 to 2521.

Incidentally, although the spare codewords are used in the presentembodiment to encode the type of edge offset, it will be appreciatedthat the spare codewords can alternatively be used for other purposes.Any other information that needs to be sent from the encoder to thedecoder can be encoded using the spare codewords.

In FIG. 26 we propose a further embodiment for determining the offsetsto be applied in the case of the band offset. This embodiment ismotivated by tests showing that in the case of band offset a majority ofoffsets have low amplitudes in absolute value. Indeed, offset values arein general equal to −2, −1, 1 and 2. When the number of classes in arange is reduced to 4, for instance as in the example of FIGS. 20A to25, the number of different groups of 4 offset values is also reduced.In the example above with 4 different offsets values and 4 classes, thenumber of different groups is 4⁴=256. In the embodiments of FIGS. 21,22, 23 and 25, 8 bits are used to encode the offset values (4 offsetvalues, each encoded using 2 bits). Here, it is considered that allgroups of 4 offsets have the same probability of being selected.However, some of these groups are less probable than others. By removingthe less probable groups, it is possible to reduce the number of bitsrequired to encode them. As a consequence, instead of encoding 4different offset values using 2 bits for each offset value, we proposeto assigns indexes to different groups of 4 offset values and to encodethe index, the index being encoded using less than 8 bits thanks to theremoval of the less probable groups. The probabilities of groups couldbe determined by applying SAO on a set of training sequences andcomputing statistics on the groups. A table gathering all possiblegroups ordered according to their probability of being selected could bepre-determined and known by the encoder and the decoder. In this table,each group of offsets will be associated to an index value. The numberof bits allocated to the index of groups encoding could be fixed(standardized) or fixed for a sequence, a frame, a slice or a LCU andencoded in the corresponding headers. A subset of groups in the tablecorresponding to the most probable groups will be determined by theencoder and the decoder depending on the number of bits allocated to theindex encoding.

An embodiment representing the selection of the best group is describedin FIG. 26. The process starts with step 2601 in which a variable j isinitialized. This variable j is progressively increased to allow testingof all possible groups of offsets. In the proposed embodiment, weconsider groups of 4 offsets but other numbers of offsets could beconsidered. In step 2603 we test if all groups have been tested (forinstance NbOffsetGroup could be equal to 128). If yes, the process stopsand a codeword of less than 8 bits corresponding to the selected groupis encoded. If not, the process continues with the initialization of avariable i allowing to test all classes in a range (step 2605). In step2606, the variable SumDiff(j) representing the sum of the differencebetween original samples and SAO filtered encoded samples correspondingto the group of offset j is initialized to 0. Here, only 4 classes areconsidered, but other numbers of classes consistent with the number ofoffsets are possible. In step 2607, if some classes remain to be tested,we initialize a variable k allowing to test all possible samples in arange of samples corresponding to the class i. With steps 2611 to 2619we compute the sum of the absolute values of the differences betweenencoded samples filtered with the offset of class i in the group ofoffsets j and original samples in the considered class i. Here orig (k)is an average of original sample values corresponding to the encodedvalue enc(k). Filter(i,j) is the offset value corresponding to class i,in the offset group j. SumDiff(j), is the sum of differences computed onall classes constituting a range (here 4 classes). In the loopcomprising steps 2621 to 2626, all computed sums of differences arecompared and the index of the group having the minimum sum is selected.The selected index corresponds to the group of offsets allowing, whenapplied to encoded samples, to minimize the difference between filteredsamples and original sample.

During the syntax encoding process, the encoding of the offset values asrepresented for instance by steps 2211 to 2213 in FIG. 22, is replacedby the encoding of the index corresponding to the selected group ofoffsets.

Classification of Luma component pixels is performed separately to theclassification of chroma U or V component pixels and thus eachclassification can be adapted accordingly such that each class has asimilar number of pixels.

Methods of embodiments of the invention thus provide a more flexibleclassification approach which can be adapted to provide a more optimalclassification independently for both Luma or Chroma signals therebyleading to an improvement in coding efficiency.

Although the present invention has been described hereinabove withreference to specific embodiments, the present invention is not limitedto the specific embodiments, and modifications will be apparent to askilled person in the art which lie within the scope of the presentinvention.

For example, while the previous embodiments have been described inrelation to pixels of an image and their corresponding pixel values, itwill be appreciated that within the context of the invention a group ofpixels may be considered together with a corresponding group pixelvalue. A sample may thus correspond to one or more pixels of an image.

Further aspects of the present invention are set out below.

According to a first further aspect of the invention there is provided amethod of providing compensation offsets for a set of reconstructedsamples of an image, each sample having a respective sample value, thesample values of a plurality of samples of the set being representableby a statistical distribution of sample values, the method comprisingdetermining, in dependence on properties of the statistical distributionof sample values, a plurality of classes for repartition of the samplesaccording to their corresponding sample value, each class defining arespective range of sample values; and associating, with each determinedclass, a respective compensation offset for application to therespective sample value of each sample of the said class.

Since in this aspect of the invention the statistical distribution ofthe sample values is taken into account in the determination of theclassification of samples, the classification may be adapted accordinglyto all possible ranges of sample values. Moreover the classification canbe adapted according to the component type of the samples. For example,in the case of pixels corresponding to a Chroma signal, the distributionof pixel values tends to be more concentrated around peak pixel valuescompared to that of a Luma signal which provides a more widely spreadout distribution. Methods of embodiments of the invention thus provide amore flexible classification approach which can be adapted to provide amore optimal classification independently for both Luma or Chromasignals thereby leading to an improvement in coding efficiency.

In an embodiment the properties of the statistical distribution comprisea determined centre of the statistical distribution of image samplevalues.

In an embodiment the properties of the statistical distribution comprisea useful range of sample values of the statistical distribution.

In an embodiment the classes are determined such that the samples areshared substantially uniformly among the classes.

In an embodiment the samples of the set may be of at least a firstcomponent type or a second component type, and wherein the plurality ofclasses is determined dependent on the component type of the set ofsamples.

In an embodiment the number of classes is predetermined, the range ofsample values defined for each class being determined in dependence onthe properties of the statistical distribution.

In another embodiment the number of classes and the range of samplevalues defined for each class are determined in dependence on theproperties of the statistical distribution.

In an embodiment the number of classes is determined in dependence onthe number of samples having a sample value in the useful range.

In an embodiment the number of classes is determined according to thecomponent type.

In an embodiment the method includes determining a maximum number ofsample values per class according to the number of sample values in theuseful range.

In an embodiment determining the plurality of classes comprisesselecting, from a plurality of predetermined classifications, aclassification defining the plurality of classes adapted to theproperties of the statistical distribution.

In an embodiment the range of sample values for each class, the centreof the statistical distribution and/or the useful range of sample valuesis determined based on rate distortion criteria.

In an embodiment the range of sample values for each class, the centreof the statistical distribution and/or the useful range of sample valuesis predetermined. In an embodiment the useful range of sample values isdetermined based on a comparison of the sample values with respect to athreshold value, wherein the threshold value depends on the total numberof samples, the threshold value depends on the component type of thesamples, or the threshold value is a predetermined value.

In an embodiment the compensation offset for each class is determinedfrom an average of the difference between the sample value of eachreconstructed sample of the class and the respective sample value of thecorresponding original image.

In an embodiment the set of samples is one of a plurality of sets ofsamples of the image, the same number of classes being determined foreach set.

In an embodiment the sample value is representative of a bit-depth theuseful range, the range of each class and/or the center of thestatistical distribution being dependent on the bit-depth.

In an embodiment the range of sample values for a given class isdependent on the position of the class within the useful range.

In an embodiment the range of sample values for a given class located atthe edge of the statistical distribution is superior to the range ofsample values for a given class in a central region of the distribution.

In an embodiment the centre of the statistical distribution isdetermined based on the useful range.

In an embodiment the plurality of classes comprises a first group ofclasses located at a central portion of the statistical distribution anda second group of classes including a first and second sub-group ofclasses located at respective edge portions of the statisticaldistribution.

In an embodiment the positions of the second sub-group of classes in thestatistical distribution are provided as data for coding.

In an embodiment the positions of the sub-groups of the second group areindependent of the full range of the statistical distribution.

In an embodiment the center of the statistical distribution is notprovided for coding.

In an embodiment, the position of the useful range (classification)within the full range is selected from among a plurality of possiblepositions distributed over the full range, the interval between twosuccessive positions being smaller in at least one portion of the fullrange than in another portion of the full range.

For example, the portion having the smaller interval can be in themiddle of the full range.

According to another example, the portion having smaller interval can beat one or both ends of the full range.

The positions may be center positions. Alternatively, they may be endpositions.

The possible positions may be assigned indexes.

In an embodiment the range of sample values for each class, the centreof the statistical distribution and/or the useful range of sample valuesis predetermined.

In an embodiment, at least two different types of offset values may begenerated, one of the types being so-called band offset values which, asdescribed above, are associated respectively with classes (ranges ofsample values). One or more other types of offset values may beso-called edge offset values. There may be a different type of edgeoffset values per direction, for example four different typescorresponding respectively to four different directions. Thus, there maybe a set of edge offset values per direction. One type of offset value(band or edge) may then be selected. The selection criterion is notlimited but one suitable criterion is a rate-distortion criterion. Onlythe selected type of SAO filtering (band or edge offset) is then appliedby the encoder and decoder. The selection may be carried out for eachframe area, Additionally, it may be possible to select “no SAO”, i.e. toapply neither band nor edge offsets, for example if no significantimprovement is obtained by either type. In an embodiment the selectedtype of SAO filtering is encoded and transmitted by the encoder to thedecoder.

In an embodiment, a fixed length code is used to encode the selectedtype.

In an embodiment, when the selected type is band offset, a valuerepresentative of the position of the useful range is encoded. Theposition may be a center position or an end position of the usefulrange.

In an embodiment, a fixed length code is used to encode the position ofthe useful range.

In an embodiment, when the number of different codewords allowed by thelength of the fixed length code used to encode the codewordscorresponding to the values representative of the position of the usefulrange is higher than the actual number of different possible positions,spare codewords are used to encode other information. For example, inone embodiment, the spare codewords are used to encode the type(direction) of the edge offset.

In an embodiment, compensation offsets are encoded with fixed lengthcodes. This can apply to band offsets or edge offsets or both types ofoffset.

In an embodiment, the number of different compensation offsets allowedby the length of the fixed length code is lower than the number ofpossible compensation offsets.

In an embodiment, a multiplication factor is applied to the compensationoffset values, and the multiplied compensation offset values are usedfor filtering.

In an embodiment, the multiplication factor is transmitted from theencoder to the decoder.

In an embodiment, a shifting value is applied to the compensation offsetvalues, and the shifted compensation offset values are used forfiltering.

In an embodiment, the shifting value is transmitted from the encoder tothe decoder.

In an embodiment, the edge offset values for at least one type(direction) are predetermined.

In an embodiment, a flag indicating if compensation offsets have to beapplied or not on a set of reconstructed samples of an image is encoded.

In an embodiment, groups of band offset values are predefined, eachoffset of the group being associated with one class of a useful range.

In an embodiment, each group is assigned an index.

In an embodiment, predefined groups are gathered in a table, the tableorder depending on the probability of selection of each group.

In an embodiment, the probability of selection of each group is computedby applying methods of providing compensation offsets embodying thepresent invention to a set of training sequences.

In an embodiment, the group of band offset values among the predefinedgroups of band offset values that has the minimum difference betweenoriginal samples and filtered samples is selected.

In an embodiment, the indexes of the groups are encoded using a fixedlength code.

In an embodiment, the number of different encoded indexes of groupsallowed by the length of the fixed length code is lower than the numberof possible different groups.

In an embodiment, a subset of groups of band offsets within the possibledifferent groups is determined in dependence upon the probability ofselection of each group and the length of the fixed length code.

In an embodiment, the length of the fixed length code used to encode theindexes of the groups of band offsets is predetermined.

In an embodiment, the length of the fixed length code used to encode theindexes of the groups of compensation offsets is encoded in a sequenceheader, a group of picture header, a picture header, a slice header or aLCU header.

According to a second further aspect of the invention there is provideda method of encoding an image composed of a plurality of samples, themethod comprising encoding the samples; decoding the encoded samples toprovide reconstructed samples; performing loop filtering on thereconstructed samples, the loop filtering comprising applyingcompensation offsets to the sample values of the respectivereconstructed samples, each compensation offset being associated with arange of sample values, wherein the compensation offsets are providedaccording to the method of the first further aspect; and generating abitstream of encoded samples.

In an embodiment the method includes transmitting, in the bitstream,encoded data representative of the respective compensation offsets foreach class.

In an embodiment the method includes transmitting, in the bitstream,encoded classification data defining the plurality of determinedclasses.

In an embodiment the classification data comprises data representativeof a centre of the statistical distribution.

In an embodiment the classification data comprises data representativeof the range of sample values defined for each of the plurality ofclasses.

In an embodiment the method includes the classification data comprisesdata representative of a useful range of the statistical distribution.

According to a third further aspect of the invention there is provided amethod of decoding an image composed of a plurality of samples, themethod comprising

receiving encoded samples

decoding the encoded samples to provide reconstructed samples;

performing loop filtering on the reconstructed samples, the loopfiltering comprising applying compensation offsets to the sample valuesof the respective reconstructed samples, each compensation offset beingassociated with a range of sample values, wherein the compensationoffsets are provided according to the method of any one of the previousembodiments.

Another of the further aspects of the invention provides a method ofdecoding an image composed of a plurality of sample values, the methodcomprising

receiving encoded sample values;

receiving encoded classification data defining a plurality of classesassociated with respective compensation offsets provided according tothe method of any one of the previous embodiments, each compensationoffset corresponding to a range of sample values;

decoding the encoded samples to provide reconstructed samples anddecoding the encoded compensation offsets; and

performing loop filtering on the reconstructed samples, the loopfiltering comprising applying the received compensation offsets to theimage samples of the respective samples, according to sample value ofthe sample.

In an embodiment the classification data comprises data representativeof a centre of the statistical distribution, data representative of therange of sample values defined for each of the plurality of classes,and/or data representative of a useful range of the statisticaldistribution.

According to another one of the further aspects of the invention thereis provided a signal carrying an information dataset for an imagerepresented by a video bitstream, the image comprising a set ofreconstructable samples, each reconstructable sample afterreconstruction having a respective sample value, the sample values of aplurality of reconstructed samples of the set being representable by astatistical distribution of sample values; the information datasetcomprising: classification data representative of a plurality of classesassociated with respective compensation offsets for application to thesample values of respective reconstructed samples, wherein theclassification data is determined according to the statisticaldistribution.

In an embodiment the classification data comprises data representativeof a centre of the statistical distribution, data representative of therange of sample values defined for each of the plurality of classesand/or data representative of a useful range of the statisticaldistribution.

According to another of the further aspects of the invention there isprovided a device for providing compensation offsets for a set ofreconstructed samples of an image, each sample having a respectivesample value, the sample values of a plurality of samples of the setbeing representable by a statistical distribution of sample values, thedevice comprising

means for determining, in dependence on properties of the statisticaldistribution of sample values, a plurality of classes for repartition ofthe samples according to their corresponding sample value, each classdefining a respective range of sample values; and

means for associating, with each determined class, a respectivecompensation offset for application to the respective sample value ofeach sample of the said class.

Another of the further aspects of the invention provides an encodingdevice for encoding an image composed of a plurality of samples, thedevice comprising

an encoder for encoding the samples; a decoder for decoding the encodedsamples to provide reconstructed samples; a loop filter for filteringthe reconstructed samples, the loop filtering means comprising offsetapplication means for applying compensation offsets to the sample valuesof the respective reconstructed samples, each compensation offset beingassociated with a range of sample values, wherein the compensationoffsets are provided by the device of a previous embodiment; and abitstream generator for generating a bitstream of encoded samples.

Still another of the further aspects of the invention provides adecoding device for decoding an image composed of a plurality ofsamples, the device comprising: a receiver for receiving encodedsamples, a decoder for decoding the encoded samples to providereconstructed samples; a loop filter for loop filtering thereconstructed samples, the loop filter comprising means for applyingcompensation offsets to the sample values of the respectivereconstructed samples, each compensation offset being associated with arange of sample values, wherein the compensation offsets are provided bya device according to a previous embodiment.

Another of the further aspects of the invention provides a decodingdevice for decoding an image composed of a plurality of sample values,the device comprising: a receiver for receiving encoded sample valuesand receiving encoded classification data defining a plurality ofclasses associated with respective compensation offsets provided by adevice according to a previous embodiment, each compensation offsetcorresponding to a range of sample values; a decoder for decoding theencoded samples to provide reconstructed samples and decoding theencoded compensation offsets; and a loop filter for loop filtering thereconstructed samples, the loop filter comprising means for applying thereceived compensation offsets to the image samples of the respectivesamples, according to sample value of the sample.

Many further modifications and variations will suggest themselves tothose versed in the art upon making reference to the foregoingillustrative embodiments, which are given by way of example only andwhich are not intended to limit the scope of the invention, that beingdetermined solely by the appended claims. In particular the differentfeatures from different embodiments may be interchanged, whereappropriate.

In the claims, the word “comprising” does not exclude other elements orsteps, and the indefinite article “a” or “an” does not exclude aplurality. The mere fact that different features are recited in mutuallydifferent dependent claims does not indicate that a combination of thesefeatures cannot be advantageously used.

1. A method of providing compensation offsets for use in performingsample adaptive offset loop filtering on a set of reconstructed samplesof an image, each sample having a sample value, the method comprising:selecting, based on a rate distortion criterion, a classification fromamong a plurality of predetermined classifications, each saidpredetermined classification having a classification range equal toone-eighth of full range of the sample values and being made up of fourclasses, each defining a range of sample values within saidclassification range, into which class a sample is put if its samplevalue is within the range of the class concerned; and associating witheach class of the selected classification a compensation offset forapplication to the sample value of each sample of the class concerned.2-6. (canceled)
 7. A method according to claim 1, wherein thecompensation offset for each class is determined from an average of thedifference between the sample value of each reconstructed sample of theclass and the respective sample value of the corresponding originalimage.
 8. A method according to claim 1, wherein the sample value isrepresentative of a bit-depth, and at least one of the classificationrange, the range of each class, and the center of the selectedclassification is dependent on the bit-depth. 9-10. (canceled)
 11. Amethod of encoding an image composed of a plurality of samples, themethod comprising encoding the samples; decoding the encoded samples toprovide reconstructed samples; performing sample adaptive offset loopfiltering on the reconstructed samples, the loop filtering comprisingapplying compensation offsets to the sample values of the respectivereconstructed samples, each compensation offset being associated with arange of sample values, wherein the compensation offsets are provided byselecting, based on a rate distortion criterion, a classification fromamong a plurality of predetermined classifications, each saidpredetermined classification having a classification range equal toone-eighth of a full range of the sample values and being made up offour classes, each defining a range of sample values within saidclassification range, into which class a sample is put if its samplevalue is within the range of the class concerned, and by associatingwith each class of the selected classification a compensation offset forapplication to the sample value of each sample of the class concerned;and generating a bitstream of encoded samples.
 12. A method according toclaim 11 further comprising transmitting, in the bitstream, encoded datarepresentative of the compensation offsets associated respectively withthe plurality of classes of the selected classification.
 13. A methodaccording to claim 11, further comprising transmitting, in thebitstream, encoded classification data relating to the selectedclassification.
 14. A method according to claim 13 wherein theclassification data comprises data representative of a centre of theselected classification.
 15. A method according to claim 13, wherein theclassification data comprises data representative of an index related tothe selected classification.
 16. A method according to claim 13, whereinthe classification data comprises data representative of a position ofthe selected classification within the full range of sample values. 17.A method according to claim 16, wherein the position is an end positionof the selected classification.
 18. A method according to claim 17,wherein the end position is represented as a displacement from one endof said full range. 19-20. (canceled)
 21. A method of decoding an imagecomposed of a plurality of samples, each sample having a sample value,the method comprising: receiving encoded sample values; receivingencoded classification data; receiving encoded compensation offsets;decoding the classification data and selecting, based on the decodedclassification data, a classification from among a plurality ofpredetermined classifications, each said predetermined classificationhaving a classification range equal to one-eighth of a full range of thesample values and being made up of four classes, each defining a rangeof sample values within said classification range, into which class asample is put if its sample value is within the range of the classconcerned; decoding the encoded samples to provide reconstructed samplevalues and decoding the encoded compensation offsets; associating thedecoded compensation offsets respectively with the classes of theselected classification; and performing loop filtering on thereconstructed sample values, the loop filtering comprising applying thedecoded compensation offset associated with each class of the selectedclassification to reconstructed sample values within the range of theclass concerned. 22-24. (canceled)
 25. A method according to claim 21,wherein the classification data comprises data representative of acentre of the selected classification.
 26. A method according to claim21, wherein the classification data comprises data representative of anindex related to the selected classification.
 27. A method according toclaim 21, wherein the classification data comprises data representativeof a position of the selected classification within the full range ofsample values.
 28. A method according to claim 27, wherein the positionis an end position of the selected classification.
 29. A methodaccording to claim 28, wherein the end position is represented as adisplacement from one end of said full range. 30-32. (canceled)
 33. Acomputer-readable storage medium storing instructions of a computerprogram for implementing a method according to claim
 1. 34-44.(canceled)
 45. A device for providing compensation offsets for use inperforming sample adaptive offset loop filtering on a set ofreconstructed samples of an image, each sample having a sample value,the device comprising: a selecting unit which selects, based on a ratedistortion criterion, a classification from among a plurality ofpredetermined classifications, each said predetermined classificationhaving a classification range equal to one-eighth of a full range of thesample values and being made up of four classes, each defining a rangeof sample values within said classification range, into which class asample is put if its sample value is within the range of the classconcerned; and an associating unit which associates with each class ofthe selected classification a compensation offset for application to thesample value of each sample of the class concerned.
 46. An encodingdevice for encoding an image composed of a plurality of samples, thedevice comprising: an encoder which encodes the samples; a decoder whichdecodes the encoded samples to provide reconstructed samples; a sampleadaptive offset loop filter which filters the reconstructed samples, theloop filter comprising an offset application unit which appliescompensation offsets to the sample values of the respectivereconstructed samples, each compensation offset being associated with arange of sample values; a compensation offsets provider comprising aselecting unit which selects, based on a rate distortion criterion, aclassification from among a plurality of predetermined classifications,each said predetermined classification having a classification rangeequal to one-eighth of a full range of the sample values and being madeup of four classes, each defining a range of sample values within saidclassification range, into which class a sample is put if its samplevalue is within the range of the class concerned, and also comprising anassociating unit which associates with each class of the selectedclassification a compensation offset for application to the sample valueof each sample of the class concerned; and a bitstream generator whichgenerates a bitstream of encoded samples.
 47. A device for decoding animage composed of a plurality of samples, each sample having a samplevalue, the device comprising: a sample value receiving unit whichreceives encoded sample values; a classification data receiving unitwhich receives encoded classification data; a compensation offsetreceiving unit which receives encoded compensation offsets; aclassification data decoder which decodes the classification data; aselecting unit which selects, based on the decoded classification data,a classification from among a plurality of predeterminedclassifications, each said predetermined classification having aclassification range equal to one-eighth of a full range of the samplevalues and being made up of four classes, each defining a range ofsample values within said classification range, into which class asample is put if its sample value is within the range of the classconcerned; a sample value decoding unit which decodes the encoded samplevalues to provide reconstructed sample values; a compensation offsetdecoding unit which decodes the encoded compensation offsets; anassociating unit which associates the decoded compensation offsetsrespectively with the classes of the selected classification; and asample adaptive offset loop filter which performs sample adaptive offsetloop filtering on the reconstructed sample values, the loop filteringcomprising applying the decoded compensation offset associated with eachclass of the selected classification to reconstructed sample valueswithin the range of the class concerned.
 48. A computer-readable storagemedium storing instructions of a computer program for implementing amethod according to claim
 11. 49. A computer-readable storage mediumstoring instructions of a computer program for implementing a methodaccording to claim
 21. 50. A media storage device storing a signalcarrying an information dataset for an image represented by a videobitstream, the image comprising a set of reconstructable samples, eachreconstructable sample having a sample value, the information datasetcomprising: classification data relating to a classification selected byan encoder from among a plurality of predetermined classifications, eachsaid predetermined classification having a classification range equal toone-eighth of a full range of the sample values and being made up offour classes, each defining a range of sample values within saidclassification range, into which class a sample is put if its samplevalue is within the range of the class concerned, and each class of theplurality of classes of the selected classification being associatedwith a compensation offset for application, in sample adaptive offsetloop filtering, to sample values of the reconstructable samples withinthe range of the class concerned.
 51. A media storage device accordingto claim 50, wherein the classification data comprises datarepresentative of a centre of the selected classification.
 52. A mediastorage device according to claim 50, wherein the classification datacomprises data representative of an index related to the selectedclassification.
 53. A media storage device according to claim 50,wherein the classification data comprises data representative of aposition of the selected classification within the full range of samplevalues.
 54. A media storage device according to claim 53, wherein theposition is an end position of the selected classification.
 55. A mediastorage device according to claim 54, wherein the end position isrepresented as a displacement from one end of said full range.